<?
$poll_name = $this->poll_name;
$answers = $this->answers;
if ($this->sum_count) {
    $sum_count = $this->sum_count;
}
?>
<style type="text/css">

    #back {
        background: url("/images/forpoll.jpg") repeat-x;
        height: 23px;
        width: 192px;
        -webkit-border-radius: 6px;
            -moz-border-radius: 6px;
            border-radius: 6px;

    }

    #top {


        background-color: #799ac8; /* Old browsers */
        background-repeat: repeat-x; /* Repeat the gradient */
        background-image: -moz-linear-gradient(top, #799ac8 0%, #1b499e 100%); /* FF3.6+ */
        background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#799ac8), color-stop(100%,#1b499e)); /* Chrome,Safari4+ */
        background-image: -webkit-linear-gradient(top, #799ac8 0%,#1b499e 100%); /* Chrome 10+,Safari 5.1+ */
        background-image: -ms-linear-gradient(top, #799ac8 0%,#1b499e 100%); /* IE10+ */
        background-image: -o-linear-gradient(top, #799ac8 0%,#1b499e 100%); /* Opera 11.10+ */
        filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#799ac8', endColorstr='#1b499e',GradientType=0 ); /* IE6-9 */
        background-image: linear-gradient(top, #799ac8 0%,#1b499e 100%); /* W3C */
        -webkit-border-top-left-radius: 6px;
        -webkit-border-bottom-left-radius: 6px;
        -moz-border-bottom-left-radius: 6px;
        -moz-border-top-left-radius: 6px;
        border-top-left-radius: 6px;
        border-bottom-left-radius: 6px;
        float: left;
        padding-bottom: 23px;
        padding-top: 0;

    }

    #percent {
        color:white;
        text-shadow: 5px;

    }
</style>

<script type="text/javascript">
    $().ready(function () {
        initPoll();
    });
</script>


<?php if (!$this->sum_count): ?>

<div class="right-block borderbottom" >

    <div class="tiltebegin"></div>
    <div class="title"><h3>Опрос</h3></div>

    <div class="goright">
            <div><?=$poll_name;?></div>
           <form id="form_poll" action="">
                    <? foreach ($answers as $answer): ?>
                   <input id="<?= $answer['id'] ?>" type="radio" name="answer"
                          value="<?= $answer['name'] ?>"/> <?= $answer['name'] ?><br/>
                   <? endforeach;?>
               <input type="submit" class="btn" id="submit" value="Голосовать" style="margin-top:10px">
               </form>
             <div id="results"></div>
    </div>

</div>





    <?php else: ?>
<div class="right-block borderbottom" >

    <div class="tiltebegin"></div>
    <div class="title"><h3>Опрос</h3></div>

    <div class="goright">
            <div><h4><?=$poll_name;?></h4></div>
            <? foreach ($answers as $answer): ?>
                <div id="results">
                    <div><?= $answer['name'] ?></div>
                <div id="back">

                    <div style="width: 192px;">
                        <div id="top" style="width: <?= (round((192* $answer['votesCount']) / $sum_count)) ?>px;"></div>
                    </div>
                    <div id="percent"><?= round((100 * $answer['votesCount']) / $sum_count) ?>% (<?=$answer['votesCount'];?>)
                    </div>
                </div>

                </div><br>
                <? endforeach; ?>
            <p>Всего голосов: <?=$sum_count?></p>
    </div>

</div>

<?php endif; ?>






